Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

Tinymce in text widget #275

Merged
merged 11 commits into from
Nov 10, 2023
Merged

Tinymce in text widget #275

merged 11 commits into from
Nov 10, 2023

Conversation

KTS915
Copy link
Member

@KTS915 KTS915 commented Oct 31, 2023

This addresses Issue #273.

Description

Adds back scripts that were omitted from ~/wp-includes/script-loader.php. Also adds back code that was previously removed from ~wp-admin/js/widgets/text-widgets.js because the lack of the missing scripts caused the widget otherwise to generate many errors.

Motivation and context

This re-enables the usage of the TinyMCE editor in the text widget.

How has this been tested?

On my localhost test installation.

Screenshots

Before

Screenshot at 2023-10-31 16-53-14

After

Screenshot at 2023-10-31 16-53-58

Types of changes

  • Bug fix

@mattyrob mattyrob mentioned this pull request Nov 1, 2023
This uses a combination of vanilla JS and jQuery, but that's what the widget uses already. (Yes, the code we've inherited here is a real dog's breakfast.) At a later date we can work on replacing this with purely vanilla JS once we have it all working.

This still leaves one thing not working correctly. If two Text widgets are added in the Customizer, the second won't open; that probably needs a fix in a different file. I will investigate.
src/wp-includes/script-loader.php Outdated Show resolved Hide resolved
@mattyrob
Copy link
Collaborator

mattyrob commented Nov 1, 2023

LGTM - tested locally and Text Widgets have TinyMCE restored.

@KTS915
Copy link
Member Author

KTS915 commented Nov 1, 2023

I think there's something more to be done for the Customizer; at the moment, if you add two Text widgets there, the second won't open until you refresh the page.

@KTS915
Copy link
Member Author

KTS915 commented Nov 1, 2023

Nearly there now, I think! The last patch also fixed the sending of input to the database and refreshing the view in the Customizer.

The remaining issue is that, after adding a Text widget in the Customizer, it's not actually possible to type in the Visual tab: only in the Text tab and the title. After refreshing the page, this works fine.

@KTS915
Copy link
Member Author

KTS915 commented Nov 2, 2023

The last patch should have resolved the outstanding issue. I just increased the time for TinyMCE to destroy its previous instance before attempting to create a new one.

@xxsimoxx
Copy link
Member

xxsimoxx commented Nov 2, 2023

When you expand a text widget it gets out of the column (same behavior in 1.7.1), but when you collapse it keeps the width.

image

@KTS915
Copy link
Member Author

KTS915 commented Nov 2, 2023

When you expand a text widget it gets out of the column (same behavior in 1.7.1), but when you collapse it keeps the width.

image

I haven't seen that. Is it in a specific browser?

@xxsimoxx
Copy link
Member

xxsimoxx commented Nov 2, 2023

It's in Chrome.

@KTS915
Copy link
Member Author

KTS915 commented Nov 2, 2023

I can't reproduce that on Chrome on Linux. I'll try another computer with Windows later.

@KTS915
Copy link
Member Author

KTS915 commented Nov 2, 2023

I have now reproduced it on Windows (and it's also the case with the Custom HTML widget). It looks like a new margin-left is being added when these widgets are expanded. I will take a look.

@KTS915
Copy link
Member Author

KTS915 commented Nov 2, 2023

I've just an !important to a style rule to make sure that the Text and Custom HTML widgets stay within their containers when expanded.

Copy link
Member

@xxsimoxx xxsimoxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now works sell also in chrome.

Copy link
Member

@viktorix viktorix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now.

@mattyrob
Copy link
Collaborator

Two recent approvals after further browser testing.

@mattyrob mattyrob merged commit 77d389b into ClassicPress:develop Nov 10, 2023
9 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants